package com.sky.config;

import com.sky.properties.TencentCosProperties;
import com.sky.utils.TencentCosUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class CosConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public TencentCosUtil tencentCosUtil(TencentCosProperties tencentCosProperties) {
        return new TencentCosUtil(
                tencentCosProperties.getSecretId(), tencentCosProperties.getSecretKey(),
                tencentCosProperties.getBucketName(), tencentCosProperties.getRegion()
        );
    }
}
